<script>
	import initApp from '@/common/appInit.js';
	import openApp from '@/common/openApp.js';
	
	// #ifdef H5
		openApp() //创建在h5端全局悬浮引导用户下载app的功能
	// #endif
	import checkIsAgree from '@/uni_modules/zgj-pages/pages/uni-agree/utils/uni-agree.js';
	import uniIdPageInit from '@/uni_modules/uni-id-pages/init.js';
	export default {
		globalData: {
			searchText: '',
			appVersion: {},
			config: {},
			$i18n: {},
			$t: {},
			redirectUrl: '',
			shop:null,
			signing:false,
			registing:false,
			brand:null,
			order:null,//询单暂存信息
			cart:null,
			enquiryParams:null,
		},
		onLaunch: function(options) {
			console.log('App Launch')
			this.globalData.$i18n = this.$i18n
			this.globalData.$t = str => this.$t(str)
			initApp();
			uniIdPageInit()
			uni.onPushMessage((res) => {
						console.log("收到推送消息：",res) //监听推送消息
					})
			// #ifdef APP-PLUS
			//checkIsAgree(); APP端暂时先用原生默认生成的。目前，自定义方式启动vue界面时，原生层已经请求了部分权限这并不符合国家的法规
			// #endif

			// #ifdef H5
			// checkIsAgree(); // 默认不开启。目前全球，仅欧盟国家有网页端同意隐私权限的需要。如果需要可以自己去掉注视后生效
			// #endif

			// #ifdef APP-PLUS
			//idfa有需要的用户在应用首次启动时自己获取存储到storage中
			/*var idfa = '';
			var manager = plus.ios.invoke('ASIdentifierManager', 'sharedManager');
			if(plus.ios.invoke(manager, 'isAdvertisingTrackingEnabled')){
				var identifier = plus.ios.invoke(manager, 'advertisingIdentifier');
				idfa = plus.ios.invoke(identifier, 'UUIDString');
				plus.ios.deleteObject(identifier);
			}
			plus.ios.deleteObject(manager);
			console.log('idfa = '+idfa);*/
			// #endif
		},
		onShow: function(options) {
			if(options.referrerInfo && options.referrerInfo.extraData){ //判断是否是小程序分享过来的
				this.globalData.enquiryParams = options.referrerInfo.extraData;
			}
			console.log(this.globalData.enquiryParams,'App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	page {
		background-color: #f8f8f8;
	}
	uni-button[type=primary]{
		background-color: $uni-primary;
	}
	.button-hover[type=primary]{
		background-color: $uni-primary-disable;
	}
	uni-checkbox:not([disabled]) .uni-checkbox-input:hover {
	    border-color: $uni-primary;
	}
	
	.zgj-fx-c{
		display: flex !important;
		flex-direction: column !important;
		align-items: flex-start !important;
	}
	.zgj-row {
		display: flex !important;
		flex-direction: row !important;
		justify-content: flex-start !important;
	}
	.uni-container {
		padding: 0px;
		box-sizing: border-box;
		width: 100%;
	}
	.container{
		padding: 15px;
	}
	.zgj-list-box {
		display: flex !important;
		flex-direction: row !important;
		align-items: center !important;
		justify-content: space-between !important;
		.uni-content{
			flex: 2;
			padding: 0 7px;
		}
	}
	.uni-ellipsis-1 {
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
	.uni-ellipsis-2 {
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}
</style>
